package com.xyy.yueshijia.view.activity;

import android.os.Bundle;

import com.xyy.yueshijia.base.BaseActivity;
import com.xyy.yueshijia.base.BasePresenter;
import com.xyy.yueshijia.base.BaseView;

/**
 * Created by lxs on 2017/2/10.
 */

public abstract class MvpActivity<P extends BasePresenter>
        extends BaseActivity implements BaseView {

    protected  P presenter;

    @Override
    protected void initBefor(Bundle savedInstanceState) {
        super.initBefor(savedInstanceState);
        presenter = initPresenter();

        presenter.addView(this);
    }
    // null

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(presenter!=null){
            presenter.dettachView();
        }
    }

    protected abstract P initPresenter ();
}
